package driver.nxt.events;

import driver.events.Event;
import driver.exceptions.SensorException;
import driver.nxt.NXTController;

/**
 * Allows for getting the current turn offset
 *
 * @author David Martin
 */
public class NXTTurnOffsetEvent extends Event
{

  private static final String EVENT_NAME = "Turn Offset";
  private NXTController controller;

  /**
   *
   * @param controller the NXT controller
   */
  public NXTTurnOffsetEvent(NXTController controller)
  {
    this.controller = controller;
  }

  public String getEventName()
  {
    return EVENT_NAME;
  }

  /**
   * Gets the latest turn offset value from the controller. Negative when
   * turning left, positive when turning right, 0 if centered.
   *
   * @return the turn offset value
   * @throws driversuite.exceptions.SensorException
   */
  public String readFromSensor() throws SensorException
  {
    return "" + controller.getTurnOffset();
  }

  public String getMeasurementUnits()
  {
    return "";
  }
}
